<template>
    <div>
        <input type="text" placeholder="添加待办" v-model="myTask" @keypress.enter="toApp">
    </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue';
let myTask = ref('')
let emits = defineEmits(['sendData']);
let toApp = function () {
    if (myTask.value) {
        emits('sendData', myTask);
        myTask.value = ''
    } else {
        alert('添加内容不能为空')
    }

}
</script>

<style>

</style>